<template>
    <div class="page">
        <nav-bar title="我的信息" @click-left="$router.back()"></nav-bar>
        <div class="con">
            <van-cell-group title="基本信息">
                <van-cell title="服务商编号" :value="serverData.code||''" />
                <van-cell title="服务商名称" :value="serverData.name||''" />
                <van-cell title="手机号" :value="serverData.mobilePhone||''" />
                <van-cell title="企业性质" :value="typeName||''" />
                <van-cell title="联系人" :value="serverData.contact||''" />
                <van-cell title="联系电话" :value="serverData.contactPhone||''" />
                <van-cell title="省市区" :value="regionName||''" />
                <van-cell title="详细地址" :value="serverData.address||''" />
                <van-cell title="统一社会信用代码" :value="serverData.agentCredit||''" v-if="serverData.agentProperty=='4'" />
                <van-cell title="签约主体" :value="serverData.agentSubName||''" />
                <van-cell title="合同编号" :value="serverData.agreementNo||''" />
                <van-cell title="合同起始日期" :value="serverData.agreementStartDate||''" />
                <van-cell title="合同截止日期" :value="serverData.agreementEndDate||''" />
            </van-cell-group>

            <van-cell-group title="法人身份信息">
                <van-cell title="姓名" :value="serverData.legalPersonName||''" />
                <van-cell title="身份证号码" :value="serverData.legalCertId||''" />
            </van-cell-group>

            <van-cell-group title="结算信息">
                <van-cell title="账户类型" :value="accountTypeName||''" />
                <van-cell title="账户名称" :value="serverData.accountName||''" />
                <van-cell title="账号" :value="serverData.accountNo||''" />
                <van-cell title="开户行行号" :value="serverData.contactLine||''" />
                <van-cell title="开户行名称" :value="serverData.bankName||''" />
            </van-cell-group>
        </div>
    </div>
</template>

<script>
export default {
    // 
    data() {
        return {
            serverData: {}
        }
    },

    mounted() {
        this.prepareData();
    },

    methods: {
        show() {
            this.showPop = true
            this.prepareData();
        },

        prepareData(code) {
            this.$http.serverBaseInfo().then(resp => {
                if (resp === false) {
                    return false;
                }
                this.serverData = resp
            });
        },
    },

    computed: {
        typeName() {
            if (this.serverData.agentProperty == "4") {
                return "个人";
            } else if (this.serverData.agentProperty == "1") {
                return "企业/个体户";
            } else {
                return "";
            }
        },

        accountTypeName() {
            if (this.serverData.accountType == "2") {
                return "个人账户";
            } else if (this.serverData.accountType == "1") {
                return "对公账户";
            } else {
                return "";
            }
        },

        regionName() {
            if (!this.serverData.province) {
                return "";
            }
            return `${this.serverData.province}-${this.serverData.city}-${this.serverData.county}`;
        },

    }
}
</script>

<style lang="scss" scoped>
</style>